const Joi = require("joi");

module.exports = {
    body: {
        imageInfo: {
            imageUrl: Joi.string().required().error(new Error("图片格式不正确")), //error中可以指明错误提示（不指明就是默认）,error中参数必须是Error对象或者是一个函数
            fileName: Joi.string().required(),
            originalName: Joi.string().required(),
            size: Joi.number().required(),
            mimeType: Joi.string().required(),
            userId: Joi.number().required(),
        },
        account: Joi.string().pattern(/[0-9a-zA-Z_-]+/).min(3).max(12).required(),
        name: Joi.string().pattern(/[\u4e00-\u9fff]+/).min(3).max(12).required(),
        sex: Joi.string().pattern(/[12]{1}/).required(),
        password: Joi.string().pattern(/^(?=.*[a-zA-Z])(?=.*\d)(?=.*[!@#$%^&*_~])[a-z-A-z\d!@#$%^&*_~]{6,12}$/).required(),
        identity: Joi.ref("name"),
        deptName: Joi.ref("name"),
        email: Joi.string().email()
    }
}